#include <cstdio>
#include <cstring>

using namespace std;

const int maxn=100;

class Tree {
    public:
        int n, m, ind[maxn+1], to[2*maxn-1], link[2*maxn-1], dep[maxn+1], f[maxn+1];

        void addSide(int u, int v) {
            m++;
            to[m] = v;
            link[m] = ind[u];
            ind[u] = m;
        }

        int getDepest(int o, int fa) {
            dep[o] = dep[fa]+1;
            f[o] = o;
            for (int i=ind[o]; i; i=link[i]) {
                if (to[i]!=fa) {
                    int t=getDepest(to[i], o);
                    if (dep[f[o]]<dep[t]) {
                        f[o] = t;
                    }
                }
            }
            return f[o];
        }

        void solve(int o, int fa, int ver, int a[], int b[]) {
            b[++b[0]] = o;
            for (int i=ind[o]; i; i=link[i]) {
                if (to[i]!=fa && f[to[i]]!=ver) {
                    solve(to[i], o, ver, a, b);
                    a[++a[0]] = o;
                    b[++b[0]] = n+a[0];
                }
            }
            for (int i=ind[o]; i; i=link[i]) {
                if (to[i]!=fa && f[to[i]]==ver) {
                    solve(to[i], o, ver, a, b);
                }
            }
        }
};

int main() {
    freopen("combo.in", "r", stdin);
    freopen("combo.out", "w", stdout);

    static Tree tree;
    int n;
    scanf("%d", &n);
    tree.n = n;
    for (int i=1; i<n; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        tree.addSide(a, b);
        tree.addSide(b, a);
    }
    int root=tree.getDepest(1, 0);

    static int a[maxn+1], b[2*maxn+1];
    tree.solve(root, 0, tree.getDepest(root, 0), a, b);
    printf("%d\n", a[0]);
    for (int i=1; i<=a[0]; i++) {
        printf("%d ", a[i]);
    }
    printf("\n");
    for (int i=1; i<=b[0]; i++) {
        printf("%d ", b[i]);
    }

    fclose(stdin);
    fclose(stdout);
    return 0;
}
